package com.hy.memoryassistant;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Jeffrey on 1/9/2015.
 */
public class ReminderSQLiteHelper extends SQLiteOpenHelper {

    public static final String TABLE_REMINDERS = "Reminders";
    public static final String COLUMN_ID = "ID";
    public static final String COLUMN_TITLE = "title";
    public static final String COLUMN_PROMPT = "prompt";
    public static final String COLUMN_SUMMARY = "summary";
    public static final String COLUMN_TAG = "tag";
    public static final String COLUMN_EXT_LINK = "ext_link";
    public static final String COLUMN_MEDIA_TYPE = "media_type";
    public static final String COLUMN_DATE_ADDED = "date_added";
    public static final String COLUMN_NEXT_NOTIFICATION = "next_notification";
    public static final String COLUMN_NOTIFICATION_COUNT = "notification_count";
    public static final String COLUMN_LAST_MODIFIED = "last_modified";
    public static final String DATABASE_CREATE = "create table " + TABLE_REMINDERS + "("
            + COLUMN_ID + " integer primary key autoincrement,"
            + COLUMN_TITLE + " text not null,"
            + COLUMN_PROMPT + " text,"
            + COLUMN_SUMMARY + " text,"
            + COLUMN_TAG + " text,"
            + COLUMN_EXT_LINK + " text,"
            + COLUMN_MEDIA_TYPE + " integer,"
            + COLUMN_DATE_ADDED + " integer,"
            + COLUMN_NEXT_NOTIFICATION + " integer,"
            + COLUMN_NOTIFICATION_COUNT + " integer,"
            + COLUMN_LAST_MODIFIED + " integer);";
    public static final String DATABASE_NAME = "MA.db";
    public static final int DATABASE_VERSION = 1;

    public ReminderSQLiteHelper(Context context){
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase database){
        database.execSQL(DATABASE_CREATE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_REMINDERS);
        onCreate(db);
    }
}
